<template>
  <div class="tem-parent">
    <h4>父组件B</h4>
    <p class="info">父组件监听子组件自定义事件并接收子组件传递的参数</p>
    <childB v-on:doRise="getChildData" v-on:doReduce="getChildData" v-on:changeNum="getChildData"></childB>
    <p>这是子组件传递的值：<span>{{num}}</span></p>
    <p>这是子组件传递信息：<span>{{msg}}</span></p>
  </div>
</template>
<script>
import childB from "./childB";
export default {
  name: "parentB",
  components:{
    childB,
  },
  data(){
    return{
      num:'',
      msg:''
    }
  },
  methods:{
    getChildData(param){
      this.num=param.val;
      this.msg=param.msg
    }
  }
}
</script>

<style scoped>
  p span{
    color: #42b983;
  }
</style>
